package com.zmn.plat.services.impl.channel;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.channel.ChannelServiceMaster;
import com.zmn.plat.model.entity.channel.ChannelServiceMasterPageListVO;
import com.zmn.plat.model.entity.channel.ChannelServiceMasterQuery;
import com.zmn.plat.persistence.interfaces.channel.ChannelServiceMasterDAO;
import com.zmn.plat.services.interfaces.channel.ChannelServiceMasterService;

@Service
public class ChannelServiceMasterServiceImpl implements ChannelServiceMasterService {

    @Autowired
    private ChannelServiceMasterDAO channelServiceMasterDAO;

    @Override
    public ChannelServiceMaster findByKey(Integer id) {
        return channelServiceMasterDAO.findByKey(id);
    }

    @Override
    public List<ChannelServiceMaster> listByChannelId(Integer channelId) {
        return channelServiceMasterDAO.listByChannelId(channelId);
    }

    @Override
    public List<ChannelServiceMaster> listByChannelIdAndType(Integer channelId, Integer type) {
        return channelServiceMasterDAO.listByChannelIdAndType(channelId, type);
    }

    @Override
    public List<ChannelServiceMasterPageListVO> listPageByQuery(ChannelServiceMasterQuery query) {
        Integer count = countByQuery(query);
        query.setTotalCount(count);
        return count == 0 ? null : channelServiceMasterDAO.listPageByQuery(query);
    }

    @Override
    public Integer countByQuery(ChannelServiceMasterQuery query) {
        return channelServiceMasterDAO.countByQuery(query);
    }

    @Override
    public List<ChannelServiceMasterPageListVO> listMasterPageByQuery(ChannelServiceMasterQuery query) {
        Integer count = countMasterByQuery(query);
        query.setTotalCount(count);
        return count == 0 ? null : channelServiceMasterDAO.listMasterPageByQuery(query);
    }

    @Override
    public Integer countMasterByQuery(ChannelServiceMasterQuery query) {
        return channelServiceMasterDAO.countMasterByQuery(query);
    }

    @Override
    public int insert(ChannelServiceMaster record) {
        return channelServiceMasterDAO.insert(record);
    }

    @Override
    public int insertBatch(List<ChannelServiceMaster> list) {
        return channelServiceMasterDAO.insertBatch(list);
    }

    @Override
    public int deleteByKey(Integer id) {
        return channelServiceMasterDAO.deleteByKey(id);
    }

    @Override
    public int deleteBatch(List<Integer> ids) {
        return channelServiceMasterDAO.deleteBatch(ids);
    }
}
